package com.zjeav.lingjiao.ui.home.persenter;

import android.support.annotation.NonNull;

import com.zjeav.lingjiao.base.baseBean.Find;
import com.zjeav.lingjiao.base.baseBean.Result;
import com.zjeav.lingjiao.ui.home.model.GetFindDetailModel;
import com.zjeav.lingjiao.ui.home.view.FindDetailContract;

public class FindDetailPersenter implements FindDetailContract.Presenter,GetFindDetailModel.OnDetailListener {

    private GetFindDetailModel module;
    private FindDetailContract.View view;

    public FindDetailPersenter(FindDetailContract.View view) {
        this.view = view;
        this.module = new GetFindDetailModel();
    }


    @Override
    public void getdind(int id) {
        this.module.getFindDetail(id,this);
    }

    @Override
    public void attachView(@NonNull FindDetailContract.View view) {
        this.view = view;
    }

    @Override
    public void detachView() {
        this.view = null;
    }

    @Override
    public void OnDetailSuccess(Result<Find> result) {
        this.view.showGetFind(result);
    }

    @Override
    public void OnError(Throwable throwable) {
        this.view.showError(throwable);
    }
}
